In [2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly
import plotly.plotly as py
import plotly.figure_factory as ff
In [3]:
df = pd.read_csv('new_climate_data.csv')
df.drop('Unnamed: 0', axis = 1)
In [12]:
## [12025, 30113, 51560, 51780] Cannot be show
colorscale = ["#d2e3f3","#9ecae1",
"#85bcdb","#4292c6","#3082be","#2171b5","#1361a9",
"#08519c","#0b4083","#08306b"]
endpts =[1,2,3,4,5,6,7,8]
fips = df['FIPS'].tolist()
values = df['Avg Daily Precipitation (mm)'].tolist()
fig = ff.create_choropleth(
fips=fips, values=values,
binning_endpoints=endpts,
colorscale=colorscale,
show_state_data=False,
show_hover=True, centroid_marker={'opacity': 0},
asp=2.9, title='US Average Daily Precipitation',
legend_title='Avg Daily Precipitation (mm)'
)
py.iplot(fig, filename='choropleth_full_usa')
Out[12]:
In [38]:
categories = pd.cut(np.array(df['Avg Daily Precipitation (mm)']),4)
df['Category'] = list(categories)
groupby_category = df.groupby(['Category','State'])['County'].count()
In [43]:
groupby_category
Out[43]:
In [ ]:
## county precp data and ## condition rating of the county ## deterioration rates